package main

import (
	"fmt"
	"sort"
)

func main() {
	n := 2
	fmt.Println(arrangeCoins(n))
}

//#link: https://leetcode-cn.com/problems/arranging-coins/
func arrangeCoins(n int) int {
	return sort.Search(n, func(k int) bool { k++; return k*(k+1) > 2*n })
}
